package untitled.src.com.mtwo.work.three;
/**
 * 用户消费信息类
 * 特征：统计通话时长、统计上网流量、每月消费金额
 */
//继承AbstractPackages类
public class UserConsumptionInformation extends AbstractPackages {

    //声明统计通话时长（分钟）
    private int timeSum;
    //声明统计上网流量
    private double trafficSum;
    //声明统计每月资费
    private int chargesSum;

    //定义无参构造函数
    public UserConsumptionInformation() {
    }
    //定义有参构造函数，且赋值（通话时长，上网流量，每月资费）
    public UserConsumptionInformation(int time, double traffic, int charges) {
        //调用父类有参构造方法，且赋值（通话时长，上网流量，每月资费）
        super(time, traffic, charges);
        this.timeSum = time;
        this.trafficSum = traffic;
        this.chargesSum = charges;
    }

    //创建各变量的get和set方法，进行对变量的获取和赋值
    public int getTimeSum() {
        return timeSum += getTime();
    }

    public void setTimeSum(int timeSum) {
        this.timeSum = getTime();
    }

    public double getTrafficSum() {
        return trafficSum += getTraffic();
    }

    public void setTrafficSum(double trafficSum) {
        this.trafficSum = trafficSum;
    }

    public int getChargesSum() {
        return chargesSum += getCharges();
    }

    public void setChargesSum(int chargesSum) {
        this.chargesSum = chargesSum;
    }
    //重写父类的show方法，且打印子类中show方法的打印语句
    @Override
    public void show() {
        System.out.println("通话总时长：" + getTimeSum() + "分钟，总资费" + getChargesSum() + "元，总流量：" + getTrafficSum()+"G");
    }
}